package com.ck.ckcloud.powerenvironment.infrastructure.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ck.ckcloud.common.core.util.R;
import com.ck.ckcloud.powerenvironment.facade.PowerEnvironmentFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 设备控制器
 *	作为基础设施对外暴露REST协议的服务
 * @author Aiden <a href="mailto:adam602260@gmail.com"/>
 * @version TestResource.java v0.1
 * @create 2019-09-17 22:39
 */
@RestController
@RequestMapping("/device")
public class DeviceController {

	/**
	 * 网管门户应用层
	 */
	@Autowired
	private PowerEnvironmentFacade powerEnvironmentFacade;

	/**
	 * 分页查询机房信息
	 * @param page
	 * @return
	 */
	@GetMapping("/page")
	public R listDeviceByPage(Page page){
		IPage iPage = powerEnvironmentFacade.listDevicesByPage(page);
		return new R<>(iPage);
	}

}
